package com.glsc.ngateway.common.base.converter.platform;

import com.alibaba.excel.util.CollectionUtils;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow.FlowFormEquipmentModify;
import com.glsc.ngateway.common.base.domainmapper.FlowFormEquipmentModifyMapper;
import com.glsc.ngateway.common.api.flowable.dto.task.formData.equipment.domainDto.FlowFormEquipmentModifyDto;

import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
 * FlowFormEquipmentModify转换器
 * @author xuchang
 */
public class FlowFormEquipmentModifyConverter extends AbstractFlowFormDataConverter {
    public static FlowFormEquipmentModifyDto do2Dto(FlowFormEquipmentModify modify) {
        if (Objects.isNull(modify)) {
            return null;
        }
        FlowFormEquipmentModifyDto applyDto = FlowFormEquipmentModifyMapper.INSTANCE.domain2dto(modify);
        applyDto.setAppendicesFileList(converter2FileList(modify.getAppendicesFileIdList()));
        return applyDto;
    }

    public static List<FlowFormEquipmentModifyDto> do2Dto(List<FlowFormEquipmentModify> modifyList) {
        return CollectionUtils.isEmpty(modifyList) ? java.util.Collections.emptyList() : modifyList.stream().map(FlowFormEquipmentModifyConverter::do2Dto).collect(Collectors.toList());
    }

    public static FlowFormEquipmentModify dto2Do(FlowFormEquipmentModifyDto modifyDto) {
        if (Objects.isNull(modifyDto)) {
            return null;
        }
        FlowFormEquipmentModify apply = FlowFormEquipmentModifyMapper.INSTANCE.dto2domain(modifyDto);
        apply.setAppendicesFileIdList(converter2FileIdList(modifyDto.getAppendicesFileList()));
        return apply;
    }

    public static List<FlowFormEquipmentModify> dto2Do(List<FlowFormEquipmentModifyDto> modifyDtoList) {
        return CollectionUtils.isEmpty(modifyDtoList) ? java.util.Collections.emptyList() : modifyDtoList.stream().map(FlowFormEquipmentModifyConverter::dto2Do).collect(Collectors.toList());
    }

}
